#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n;
int a[maxn];
long long dp[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  long long oddsum = 0;
  for (int i = 1; i <= n; ++i) {
    if (i & 1) {
      oddsum += a[i];
      if (i >= 2) dp[i] = max(dp[i - 2] + a[i], dp[i - 1]);
    } else {
      dp[i] = max(oddsum, dp[i - 2] + a[i]);
    }
  }
  cout << (dp[n]) << endl;
}
